package com.corticon.dialogs.model;

import java.io.Serializable;

import javax.persistence.*;


@Entity
@Table(name = "q_displayflag")
public class DisplayFlagRecord implements Serializable {
	public enum DisplayFlagRecordType {
		QUESTION, PAGE
	}

	private Long id;
	private Dialog dialogInstance;
	private Long pageId;
	private QuestionInSet pageQuestion;
	private Boolean displayFlag;
	private String dynamicResponseEntryIndices;
	private DisplayFlagRecordType type = DisplayFlagRecordType.QUESTION;

	public DisplayFlagRecord() {
	}

	@Id
	@SequenceGenerator(name = "q_displayflag_id_seq", sequenceName = "q_displayflag_id_seq", allocationSize = 1, initialValue = 1)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "q_displayflag_id_seq")
	@Column(name = "q_displayflag_id", columnDefinition = "integer")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name = "dinstassoc_q_dinst_id")
	public Dialog getDialogInstance() {
		return dialogInstance;
	}

	public void setDialogInstance(Dialog dialogInstance) {
		this.dialogInstance = dialogInstance;
	}

	public Long getPageId() {
		return pageId;
	}

	public void setPageId(Long pageId) {
		this.pageId = pageId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pgqassoc_q_pg_q_id_oid")
	public QuestionInSet getPageQuestion() {
		return pageQuestion;
	}

	public void setPageQuestion(QuestionInSet pageQuestion) {
		this.pageQuestion = pageQuestion;
	}

	public Boolean isDisplayFlag() {
		return displayFlag;
	}

	public void setDisplayFlag(Boolean displayFlag) {
		this.displayFlag = displayFlag;
	}

	@Column(name = "dynamic_responseentry_ids")
	public String getDynamicResponseEntryIndices() {
		return dynamicResponseEntryIndices;
	}

	public void setDynamicResponseEntryIndices(String dynamicResponseEntryIndices) {
		this.dynamicResponseEntryIndices = dynamicResponseEntryIndices;
	}

	@Enumerated(EnumType.STRING)
	public DisplayFlagRecordType getType() {
		return type;
	}

	public void setType(DisplayFlagRecordType type) {
		this.type = type;
	}
}
